package com;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @Author: 朱胜伟
 * @CreateTime: 2021-01-04 09:25
 * @Description:
 */
public class test {
    public static void main(String[] args) {
        List<String> strings = new ArrayList<>();
        strings.add("1");
        strings.add("2");
        strings.add("3");
        Iterator<String> iterator = strings.iterator();
//        while (iterator.hasNext()){
//            String temp = iterator.next();
//
//            iterator.remove();
//            System.out.println(temp);
//        }
//

        for (String string : strings){
            System.out.println("-"+string);
            strings.remove(string);
        }
    }
}
